from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from page.base_page_helin import BasePage

class SelectCp(BasePage):
    #进入产品页面的定位器
    cp_selector=(By.LINK_TEXT,'产品')

    # 搜索产品定位器
    zd_selector=(By.ID,'field')
    bh_selector=(By.ID,"condition")
    nr_selector=(By.ID,"search")
    ss_selector=(By.ID,"dosearch")

    def click_cp(self):
        # 进入产品列表页面
        self.driver.find_element(*self.cp_selector).click()

        # 搜索产品
    def select_zd(self,cp_zd):
        self.zd_element=self.driver.find_element(*self.zd_selector)
        select=Select(self.zd_element)
        select.select_by_visible_text(cp_zd)

    def select_ff(self, cp_ff):
        bh_element=self.driver.find_element(*self.bh_selector)
        select=Select(bh_element)
        select.select_by_visible_text(cp_ff)

    def select_gjz(self, cp_gjz):
        self.driver.find_element(*self.nr_selector).send_keys(cp_gjz)

    def select_ss(self):
        self.driver.find_element(*self.ss_selector).click()

